
# 写一个my_enumerate函数，实现和 enumerate 函数的功能相同

def my_enumerate(iterable, start=0):
    it = iter(iterable)  # 获取到迭代器
    while True:
        try:
            value = next(it)
        except StopIteration:
            return
        yield (start, value)
        start += 1

for t in my_enumerate('ABC'):
    print(t)  # (0, 'A'),  (1, 'B'), ...
